import { useEffect } from "react";
import { RouterProvider } from "react-router-dom";
import routes from "./router";
import { ConfigProvider } from "antd";
import Language from "./components/Language";

// import useWebSocketStore from "./store/webSocket";
import useLanguageStore from "./store/language";
import "./App.css";

function App() {
  const lang = useLanguageStore((state) => state.curLanguage);
  
  useEffect(() => {
    // useWebSocketStore.getState().connect();
    // return () => {
    //   useWebSocketStore.getState().disconnect();
    // };
  }, []);

  return (
    <ConfigProvider
      locale={lang}
      theme={{
        token: {
          borderRadius: 2,
        },
      }}
    >
      <div className="App font-yahei">
        <RouterProvider router={routes} />
        <Language/>
      </div>
    </ConfigProvider>
  );
}

export default App;
